// $Id$

// Copyright by Johannes Sixt
// This file is under GPL, the GNU General Public Licence

#ifndef MEMWINDOW_H
#define MEMWINDOW_H

#include <q3popupmenu.h>
#include <q3listview.h>
#include <qcombobox.h>
#include <qlayout.h>
#include <q3dict.h>
#include <q3ptrlist.h>
#include <qmap.h>
//Added by qt3to4:
#include <QMouseEvent>
#include <Q3VBoxLayout>
#include <QEvent>

class KDebugger;
class KConfigBase;
struct MemoryDump;

class MemoryWindow : public QWidget
{
    Q_OBJECT
public:
    MemoryWindow(QWidget* parent, const char* name);
    ~MemoryWindow();

    void setDebugger(KDebugger* deb) { m_debugger = deb; }

protected:
    KDebugger* m_debugger;
    QComboBox m_expression;

    Q3ListView m_memory;
    QMap<QString,QString> m_old_memory;

    Q3VBoxLayout m_layout;

    unsigned m_format;
    Q3Dict<unsigned> m_formatCache;

    Q3PopupMenu m_popup;

    virtual bool eventFilter(QObject* o, QEvent* ev);
    void handlePopup(QMouseEvent* ev);
    void displayNewExpression(const QString& expr);

public slots:
    void slotNewExpression(const QString&);
    void slotTypeChange(int id);
    void slotNewMemoryDump(const QString&, QList<MemoryDump*>&);
    void saveProgramSpecific(KConfigBase* config);
    void restoreProgramSpecific(KConfigBase* config);
};

#endif // MEMWINDOW_H
